package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.proxy.RpcClientProxy;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangjinshan
 * @version 1.0
 * @description
 * @date 2021/7/27 下午5:17
 */
@RestController
public class UserController {


    @GetMapping("/getUser/{id}")
    public String getUserById(@PathVariable(name = "id") Integer id){
        IUserService userService = (IUserService) RpcClientProxy.createProxy(IUserService.class);
        User user = userService.getById(id);
        return user.toString();
    }
}
